package org.hishenframework.core.security;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

/**
 * 简易登陆拦截器登陆拦截器
 * @author liuwei
 *
 */
public class LoginInterceptor extends HandlerInterceptorAdapter{

	@Override
	public boolean preHandle(HttpServletRequest request,
			HttpServletResponse response, Object handler) throws Exception {
		HttpSession session = request.getSession();
		Boolean logined = (Boolean) session.getAttribute("logined");
		if(logined!=null&&logined){
			return true;
		}else{
			String str = request.getContextPath();
			response.sendRedirect(str + "/admin/login/relogin");
			return false;
		}
	}
	
	
}
